<!DOCTYPE html>
<html lang="zh"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../build/css/ztree/metro/ztree.css">
    <link rel="stylesheet" href="../../plugins/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css" media="all">
<body>
    <div class="layui-row">
        <div class="layui-col-md2">
            <div>
                <ul id="ztree" class="ztree"></ul>
            </div>
        </div>
        <div class="layui-col-md10">
            <div class="layui-btn-group menusToolBar" style="margin-top: 5px" shiro:hasPermission="upms:sysSetting:menu:add">
                <button class="layui-btn" data-type="addMenu">添加</button>
            </div>
            <hr class="layui-bg-red">
            <div>
                <table id="menus" lay-filter="menus"></table>
            </div>
        </div>
    </div>
    <div id="addMenuForm" style="margin-top:30px;display: none">
        <div action="/admin/register" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">菜单名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">Url</label>
                <div class="layui-input-block">
                    <input type="text" name="path" lay-verify="required" autocomplete="off" placeholder="请输入Url" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">权限名称</label>
                <div class="layui-input-block">
                    <input type="text" name="permission" lay-verify="required" autocomplete="off" placeholder="请输入权限名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">图标</label>
                <div class="layui-input-block">
                    <input type="text" name="icon"  autocomplete="off" placeholder="请输入图标设置" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="text" name="order"  lay-verify="required" autocomplete="off" placeholder="请输入位置次序" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-radius" lay-submit lay-filter="addMenuSubmit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-radius">重置</button>
                </div>
            </div>
        </div>
    </div>
    <shiro:hasPermission name="upms:sysSetting:menu:delete">
        <script type="text/html" id="barMenus">
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </shiro:hasPermission>
    <script type="text/html" id="showIconTpl">
        <i class="fa {{d.icon}}" aria-hidden="true"></i>
    </script>
    <script type="text/html" id="showTypeTpl">
        <span class="layui-badge layui-bg-blue">{{d.type==1?'资源':'菜单'}}</span>
    </script>

    <script src="../../plugins/layui/layui.js"></script>
    <script src="../../businessJs/menu.js"></script>
</body>
</html>